export const readAsDataURL = <T>(file: File): Promise<T> => {
  return new Promise((reslove, reject) => {
    const fr = new FileReader();
    fr.readAsDataURL(file);
    fr.onload = (ev: Event) => {
      reslove((ev.target as FileReader).result as T);
    };
    fr.onerror = reject;
  });
};
